var warehouse   = []
,   length      = 0
,   thisIndex   = -1
,   app         = null
,   use         = require('./use');

var pre = function(obj){
    warehouse.push(obj);
    length += 1;
};

var run = function(){
    if(thisIndex < length - 1){
        thisIndex += 1;
        warehouse[thisIndex](app, run);
    }else
        use.run.call(app);
};

pre.warehouse   = warehouse;
pre.run         = function(){
    app = this;
    run();
};

module.exports = pre;